package com.catering.dao;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.catering.entity.CateringAddress;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CateringAddressDao extends BaseMapper<CateringAddress> {

    @Select("select t1.*,t2.user_name,t2.nick_name from catering_address t1 left join catering_user t2 on t1.user_id = t2.user_id ${ew.customSqlSegment}")
    public IPage<CateringAddress> selectPageList(IPage<CateringAddress> page, @Param(Constants.WRAPPER) QueryWrapper<CateringAddress> queryWrapper);

    @Select("select count(1) from catering_address t1 left join catering_user t2 on t1.user_id = t2.user_id ${ew.customSqlSegment}")
    public int selectPageCount(@Param(Constants.WRAPPER) QueryWrapper<CateringAddress> queryWrapper);

    @Select("select t1.*,t2.user_name,t2.nick_name from catering_address t1 left join catering_user t2 on t1.user_id = t2.user_id ${ew.customSqlSegment}")
    public List<CateringAddress> selectNoPageList(@Param(Constants.WRAPPER) QueryWrapper<CateringAddress> queryWrapper);
	
}
